using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using sbMembership.Library.Presenters;

namespace Tests.sbMembership.AddUser
{
    [TestFixture]
    public class AddUserTest
    {
        private MockAddUserView mockView;
        private AddUserPresenter presenter;
        private bool addUserCompleteEventRaised;

        [TestFixtureSetUp]
        public void Setup()
        {
            mockView = new MockAddUserView();
            presenter = new AddUserPresenter(mockView);
            mockView.AttachPresenter(presenter);
        }

        [Test]
        public void InitView()
        {
            presenter.InitView();
        }

        [Test]
        public void AddUser()
        {
            presenter.AddUserCompleteEvent = new EventHandler(OnAddUserCompleteEvent);
            presenter.AddUser(true);
            Assert.IsTrue(addUserCompleteEventRaised);
        }

        void OnAddUserCompleteEvent(object sender, EventArgs e)
        {
            addUserCompleteEventRaised = true;
        }

    }
}
